using System;
using System.Windows.Forms;
using WindowsLive.Writer.Api;

namespace TemplatePlugin
{
    [WriterPlugin("615CC200-5985-11DB-8373-B622A1EF5492", "TemplatePlugin",
        ImagePath = "Images.Template.png",
        PublisherUrl = "http://jeffrey.vanneste.ca",
        Description = "Add saved templates into your post")]
	[InsertableContentSource( "Template" )]
    public class TemplatePlugin : ContentSource
	{
        public static readonly string PluginsFolder = @"Plugins\Templates\";

        public TemplatePlugin()
		{
		}

		public override DialogResult CreateContent(IWin32Window dialogOwner, ref string newContent)
		{
            using (ChooseTemplateForm chooseTemplateForm = new ChooseTemplateForm())
			{
                DialogResult result = chooseTemplateForm.ShowDialog();
				if(result == DialogResult.OK)
				{
                    newContent = chooseTemplateForm.Template;
				}
				return result;
			}
		}
	}
}
